package com.book.modules.core.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * Description：
 * @Author： leo.xiong
 * @CreateDate： 2019/10/14 10:44
 * @Email： leo.xiong@suyun360.com
 * Version：1.0
 */
@Data
public abstract class BaseEntity<T> implements Serializable {
    private static final long serialVersionUID = -1L;

    /**
     * 主键id @JSONField该注解是解决Long类型太长传值前端精度丢失
     */
    @TableId(value = "ID", type = IdType.AUTO)
    @JSONField(serializeUsing = ToStringSerializer.class)
    @Size(max = 20, message = "{noMoreThan}")
    protected Long id;

    /**
     * 数据状态（0：正常；1：删除；2：审核；3：冻结）
     */
    public static final Integer STATUS_NORMAL = 0;
    public static final Integer STATUS_DELETE = 1;
    public static final Integer STATUS_AUDIT = 2;
    public static final Integer STATUS_BLOCK = 3;

    public BaseEntity() {
    }
}
